//package run.siyuan.rabbitmq.demo.config;
//
//import org.springframework.amqp.core.Queue;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import run.siyuan.common.constant.rabbitmq.Constants;
//
//
//@Configuration
//public class RabbitConfig {
//    //simple模式
//    @Bean(value = Constants.SIYUAN_RABBITMQ_TEST_QUEUE)
//    public Queue getQueue() {
//        return new Queue(Constants.SIYUAN_RABBITMQ_TEST_QUEUE_MESSAGE, true);
//    }
//
//    /**
//     * 配置消息的序列化
//     * bug: 不配置会将消息转换为byte数组
//     *
//     * @param connectionFactory
//     * @return
//     */
//    @Bean
//    public RabbitTemplate jsonRabbitTemplate(ConnectionFactory connectionFactory) {
//        RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
//        rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
//        return rabbitTemplate;
//    }
//}